<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>
<title></title>
<!-- 报销出纳付款【支付方式】 -->
<script type="text/javascript">
  var DoPayWindow = new Ext.Window({
      el: 'doPayWindow',
      width: 300,
      height: 120,
      layout : 'fit',
      closeAction:'hide',
      buttonAlign:'center',
      modal:'true',
      buttons:[{
        text:'确定',
        handler:function(){
         if (DoPayWindow.check()){ 
       	    Ext.MessageBox.confirm('提示','您确认要付款此报销单吗？', function(btn){
       	        if (btn == 'yes') {  
             	     $.ajax({
             			url: '${ctx}/reimb/doPayReimb.do',
             			type: 'post',
             			dataType: 'json',
             			data: {reimbId : rId, payType : payTypeVal},
             			success: function(rst, textStatus){
             	  		  if(rst.result == "success"){
             	  			window.location = '${ctx}/reimb/cashierPayIndex.do';	      	  		
             	  	  	  }else{
             	  	  		DoPayWindow.hide();
             	  	  		alert("付款失败，请重试...");
             	  	  	  }
             			}
             	  	 });
               	     DoPayWindow.hide();
                     DoPayWindow.clear();
       	        }
       	    });	
          }
        }
     }, {text:'取消',
         handler:function(){
      	   DoPayWindow.hide();
           DoPayWindow.clear();
         }
     }]
  });
  
  // 清空
  DoPayWindow.clear = function() {
    document.getElementById('payType').value = '';
  };
  
  // 检测
  DoPayWindow.check = function() {
    if (payTypeVal == null || payTypeVal == '') {
        Ext.MessageBox.show({
             title:'提示',
             minWidth:220,
             msg:'<div style=\'width:180\';><br/>请选择支付方式！</div>',
             buttons:Ext.MessageBox.OK,
             icon:Ext.MessageBox.INFO
        });
        return false;
    }
   return true;
  };
  
  var payTypeVal = null;
  
  function setTypeValue(tValue) {
	  payTypeVal = tValue;
  }
  
  var rId = null;
  function showDoPayWindow(reimbId) {
	this.rId = reimbId;
	DoPayWindow.show();
  }
</script>
</head>
<body>
<div id="doPayWindow" class="x-hidden">
<div class="x-window-header">出纳付款</div>
<div class="x-window-body">
	<table align="center" cellspacing="6">
	  <tr></tr>
	  <tr>
	    <td align="right">支付方式：</td>
	    <td>
	    	<s:radio list="payTypeMap" id="payType" name="payType" onchange="setTypeValue(this.value)"  cssStyle="border:0px;"/> 
            <font color="red">*</font>
        </td>
	  </tr>
	</table>
</div>
</div>
</body>